import cookies from 'cookies-js';

const TOKEN_KEY = 'token';

const isLogged = () => {
	return !!cookies.get(TOKEN_KEY);
};

const getToken = () => {
	return cookies.get(TOKEN_KEY);
};

const setToken = (token: string) => {
	cookies.set(TOKEN_KEY, token);
};

const clearToken = () => {
	cookies.set(TOKEN_KEY, null);
};

export { isLogged, getToken, setToken, clearToken };
